
#pragma once
#ifndef _RWJSON_H_
#define _RWJSON_H_

#include "Read_file.h"
#include "Write_file.h"

#include <SDC/system.h>

class RWJsonFile : public IReadFile, public IWriteFile {
private:
    ptree pt;
    string name_file;

public:
    RWJsonFile(const string name_path_file = MAIN_SETTING)
        : name_file(name_path_file) {}

    RWJsonFile(RWJsonFile &&) = delete;
    RWJsonFile &operator=(RWJsonFile &&) = delete;

    RWJsonFile(const RWJsonFile &other) { name_file = other.name_file; }
    void operator=(const RWJsonFile &other) { name_file = other.name_file; }
    void operator=(const string name_path_file) { name_file = name_path_file; }

    string readStr(const string name_read_data_file) override;
    int readInt(const string name_read_data_file) override;
    bool readBool(const string name_read_data_file) override;
    vector_str readVectorStr(const string name_read_data_file) override;
    vector_int readVectorInt(const string name_read_data_file) override;

    void write(const string data_write_str,
                const string name_write_data_file) override;
    void write(const int data_write_int,
                const string name_write_data_file) override;
    void write(const bool data_write_bool,
                const string name_write_data_file) override;
    void write(const vector_str &data_write_vector_str,
                const string name_write_data_file) override;
    void write(const vector_int &data_write_vector_int,
                const string name_write_data_file) override;

    void closeWrite(const string name_write_file) override;

    ~RWJsonFile() override {}
};

#endif
